package com.example.thread.rest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author void
 * @date 2021/2/24 13:10
 * @desc
 */
@RestController
public class TestController {
    
    @GetMapping("/test1")
    public String test1(){
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.submit(()->{
            try {
                Thread.sleep(10000);
                System.out.println("睡眠结束");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        executor.shutdown();
        return "ok";
    }
}
